package edu.uclmgmu.bacteriosec.aspects.java.io.PrintStream;

import java.io.*;

import edu.uclmgmu.bacteriosec.aspects.common.Store;

privileged aspect PrintStream_CountCalls {
	
	
	void around(java.io.PrintStream caller, String a) : call(void java.io.PrintStream.print(String)) && 
			target(caller) && args(a) &&
			!cflow(within(PrintStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		proceed(caller, a);
	}
	
	void around(java.io.PrintStream caller, String a) : call(void java.io.PrintStream.println(String)) && 
			target(caller) && args(a) &&
			!cflow(within(PrintStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		proceed(caller, a);
	}

	//	Object around() : call(* java.io.*.*(..))&& 
	//			!cflow(within(PrintStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
	//			&& !within(junit.*) {
	//		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
	//		System.out.println("java.io\t" + thisJoinPointStaticPart.getSignature().toString() + "\t" +
	//				thisJoinPoint.getSignature().toString() + "\t");
	//		return proceed();
	//	}



}
